﻿<moria:MoriaPage x:Class="Moria.Silverlight.Views.GameBoard" 
                 xmlns:moria="http://Moria/Silverlight"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
					  xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
                 xmlns:rb="http://Redbrick/Silverlight"
					  mc:Ignorable="d"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 d:DesignWidth="750" d:DesignHeight="550" 
           Title="Game Board">
	<i:Interaction.Triggers>
		<rb:KeystrokeCommandTrigger Command="SaveGameCommand" FiredOn="KeyUp" Gesture="ctrl+S"/>
		<rb:KeystrokeCommandTrigger Command="MoveWestCommand" FiredOn="KeyUp" Gesture="Left"/>
		<rb:KeystrokeCommandTrigger Command="MoveEastCommand" FiredOn="KeyUp" Gesture="Right"/>
		<rb:KeystrokeCommandTrigger Command="MoveNorthCommand" FiredOn="KeyUp" Gesture="Up"/>
		<rb:KeystrokeCommandTrigger Command="MoveSouthCommand" FiredOn="KeyUp" Gesture="Down"/>
	</i:Interaction.Triggers>
	<Grid x:Name="LayoutRoot" Background="White"  >
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto" />
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="90"/>
			<RowDefinition Height="*" MinHeight="410"/>
			<RowDefinition Height="45"/>
		</Grid.RowDefinitions>

		<!-- left side info bar -->
		<Border BorderBrush="Black" BorderThickness="2" 
                HorizontalAlignment="Left" VerticalAlignment="Stretch" 
                CornerRadius="5,0,5,5" 
                Width="130" 
                Padding="0,5" Margin="5,5,0,0" 
                MinHeight="500" Grid.RowSpan="2">
			<Grid DataContext="{Binding Player}" ShowGridLines="False">

				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="80*" />
					<ColumnDefinition Width="46*" />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="20"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="20"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="20"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="*"/>
				</Grid.RowDefinitions>
				<Grid.Resources>
					<Style TargetType="TextBlock">
						<Setter Property="VerticalAlignment" Value="Center"/>
					</Style>
				</Grid.Resources>
					<TextBlock Text="{Binding name}" Style="{StaticResource Label}" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"/>
				<TextBlock Text="{Binding Race.trace}" Style="{StaticResource Label}" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"/>
				<TextBlock Text="{Binding Class.title}" Style="{StaticResource Label}" HorizontalAlignment="Center" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"/>
				<TextBlock Text="{Binding Title}" Style="{StaticResource Label}" HorizontalAlignment="Center" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"/>

				<TextBlock Text="Level:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="4" Grid.Column="0"/>
				<TextBlock Text="{Binding lev}"  HorizontalAlignment="Center"   Grid.Row="4" Grid.Column="1" />

				<TextBlock Text="Exp:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="5" Grid.Column="0"/>
				<TextBlock Text="{Binding exp}"  HorizontalAlignment="Center"   Grid.Row="5" Grid.Column="1" />

				<TextBlock Text="Au:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="6" Grid.Column="0"/>
				<TextBlock Text="{Binding au}"  HorizontalAlignment="Center"   Grid.Row="6" Grid.Column="1" />

				<TextBlock Text="Str:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="8" Grid.Column="0"/>
				<TextBlock Text="{Binding Str}"  HorizontalAlignment="Center"   Grid.Row="8" Grid.Column="1" />

				<TextBlock Text="Int:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="9" Grid.Column="0"/>
				<TextBlock Text="{Binding Int}"  HorizontalAlignment="Center"   Grid.Row="9" Grid.Column="1" />

				<TextBlock Text="Wis:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="10" Grid.Column="0"/>
				<TextBlock Text="{Binding Wis}"  HorizontalAlignment="Center"   Grid.Row="10" Grid.Column="1" />

				<TextBlock Text="Dex:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="11" Grid.Column="0"/>
				<TextBlock Text="{Binding Dex}"  HorizontalAlignment="Center"   Grid.Row="11" Grid.Column="1" />

				<TextBlock Text="Con:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="12" Grid.Column="0"/>
				<TextBlock Text="{Binding Con}"  HorizontalAlignment="Center"   Grid.Row="12" Grid.Column="1" />

				<TextBlock Text="Chr:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="13" Grid.Column="0"/>
				<TextBlock Text="{Binding Chr}"  HorizontalAlignment="Center"   Grid.Row="13" Grid.Column="1" />

				<TextBlock Text="Cur AC:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="15" Grid.Column="0"/>
				<TextBlock Text="{Binding dis_ac}"  HorizontalAlignment="Center"   Grid.Row="15" Grid.Column="1" />

				<TextBlock Text="Max HP:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="16" Grid.Column="0"/>
				<TextBlock Text="{Binding mhp}"  HorizontalAlignment="Center"   Grid.Row="16" Grid.Column="1" />

				<TextBlock Text="Cur HP:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="17" Grid.Column="0"/>
				<TextBlock Text="{Binding chp}"  HorizontalAlignment="Center"   Grid.Row="17" Grid.Column="1" />

				<TextBlock Text="Max Mana:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="18" Grid.Column="0"/>
				<TextBlock Text="{Binding mana}"  HorizontalAlignment="Center"   Grid.Row="18" Grid.Column="1" />

				<TextBlock Text="Cur Mana:" Style="{StaticResource Label}" HorizontalAlignment="Left" Grid.Row="19" Grid.Column="0"/>
				<TextBlock Text="{Binding cmana}"  HorizontalAlignment="Center"   Grid.Row="19" Grid.Column="1" />

			</Grid>
		</Border>

		<!-- message list -->
		<ItemsControl x:Name="lbMessages" Grid.Row="0" Grid.Column="1" Margin="5" Height="80"
                 VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Auto"
                 BorderBrush="Black" BorderThickness="1" ItemsSource="{Binding Messages}" />

		<!-- the game map -->
		<ScrollViewer Grid.Row="1" Grid.Column="1" 
                      VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
            <moria:MoriaCanvas x:Name="theMap" Background="Bisque" HorizontalAlignment="Left" VerticalAlignment="Top" />
			<!--<moria:MapGrid Background="Bisque" />-->
		</ScrollViewer>
        
        <TextBlock Grid.Row="1" Grid.Column="1" Margin="5" VerticalAlignment="Top" HorizontalAlignment="Right" Text="{Binding ElementName=theMap, Path=ActualWidth, StringFormat=Width: \{0\}, ValidatesOnNotifyDataErrors=False}"/>
        <TextBlock Grid.Row="1" Grid.Column="1" Margin="5,20,5,5" VerticalAlignment="Top" HorizontalAlignment="Right" Text="{Binding ElementName=theMap, Path=ActualHeight, StringFormat=Height: \{0\}, ValidatesOnNotifyDataErrors=False}"/>

        <!--<ItemsControl Grid.Row="1" Grid.Column="1"  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Auto"
                 BorderBrush="Black" BorderThickness="1" ItemsSource="{Binding Cave}" >
            <ControlTemplate>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                    <ItemsPresenter/>
                </ScrollViewer>
            </ControlTemplate>
            <ItemsPanelTemplate>
                <moria:MapGrid Width="{Binding Cave.GlyphWidth,Mode=TwoWay}"
                               Height="{Binding Cave.GlyphHeight,Mode=TwoWay}">                    
                </moria:MapGrid>
            </ItemsPanelTemplate>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Image Source="{Binding Glyph.Image}" Width="32" Height="32" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>-->

		<!-- status bar -->
		<Border x:Name="Status" BorderBrush="Black" Margin="5" BorderThickness="1" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
			<TextBlock VerticalAlignment="Center">status</TextBlock>
		</Border>
	</Grid>
</moria:MoriaPage>
